#!/usr/bin/python
# -*- coding: utf-8 -*-

a = 100
def foo():
    a = 200
    def foo_in():
        nonlocal a
        a = 300
        print('foo_in',a)
    foo_in()
    print('foo',a)
foo()
print('out',a)